package com.chinairi.mall.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chinairi.mall.model.GoodsFeature;
import com.chinairi.mall.model.Measurement;
import com.chinairi.mall.dao.MeasurementMapper;
import com.chinairi.mall.service.IMeasurementService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Webgasd
 * @since 2020-09-12
 */
@Service
public class MeasurementServiceImpl extends ServiceImpl<MeasurementMapper, Measurement> implements IMeasurementService {
    @Autowired
    private MeasurementMapper measurementMapper;

    /**
     * 计量单位配置
     *
     * @param measurement
     */
    @Override
    public void config(Measurement measurement) {
        measurement.setMuDbid(UUID.randomUUID().toString().replace("-", ""));
        measurementMapper.insert(measurement);
    }

    /**
     * 获取所有特征量
     *
     * @return
     */
    @Override
    public List<Measurement> getTypeList() {
        return measurementMapper.getTypeList();
    }

    /**
     * 获取所有特征量单位
     *
     * @return
     */
    @Override
    public List<Measurement> getUnitList(String type) {
        return measurementMapper.getUnitList(type);
    }
}
